package com.community.backend.mapper;

import com.community.backend.annotation.AutoFill;
import com.community.backend.enumeration.OperationType;
import com.community.backend.pojo.Security;
import com.community.backend.pojo.dto.RegisterDTO;
import com.community.backend.pojo.dto.SecurityQueryDTO;
import com.github.pagehelper.Page;
import lombok.ToString;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface SecurityMapper {
    Page<Security> pageQuery(SecurityQueryDTO securityQueryDTO);
@AutoFill(OperationType.INSERT)
    Integer add(Security security);

//    Integer deleteById(Integer id);
@AutoFill(OperationType.UPDATE)
    Integer update(Security security);
@Select("select * from security where username=#{username} and password=#{password} and status = '在职'")
    Security login(String username, String password);
@Insert("insert into security(username,password) values(#{username},#{password})")
    void register(RegisterDTO registerDTO);
@AutoFill(OperationType.UPDATE)
    Integer updateById(Security security);
}
